﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace FamilyShowSource.Models
{
    /// <summary>
    /// Describes the kinship between person objects
    /// </summary>
    public abstract class Relationship
    {
        /// <summary>
        /// The Relationship type between the person objects
        /// Such as: Parent, child, sibling, or spouse
        /// </summary>
        public RelationshipType RelationshipType { get; set; }

        /// <summary>
        /// The person object who is concerned wihh the relationship
        /// </summary>
        public Person RelationTo { get; set; }
    }

    /// <summary>
    /// Describes the kinship between a child and parent.
    /// </summary>
    public class ParentRelationship : Relationship
    {
        /// <summary>
        /// Determine the relationship is natural or adopted
        /// </summary>
        public ParentChildModifier ParentChildModifier { get; set; }

        /// <summary>
        /// The default constructor
        /// </summary>
        public ParentRelationship() { }

        /// <summary>
        /// The constructor with specified information
        /// </summary>
        /// <param name="person">The person is concerned with the relationship</param>
        /// <param name="parentChildType">Determine the relationship is natural or adopted</param>
        public ParentRelationship(Person person, ParentChildModifier parentChildType)
        {
            this.RelationshipType = RelationshipType.Parent;
            this.RelationTo = person;
            this.ParentChildModifier = parentChildType;
        }
    }

    /// <summary>
    /// Describes the kindship between a parent and child.
    /// </summary>
    public class ChildRelationship : Relationship
    {
        /// <summary>
        /// Determine the relationship is natural or adopted
        /// </summary>
        public ParentChildModifier ParentChildModifier { get; set; }

        /// <summary>
        /// The default constructor
        /// </summary>
        public ChildRelationship() { }

        /// <summary>
        /// The constructor with specified information
        /// </summary>
        /// <param name="person">The person is concerned with the relationship</param>
        /// <param name="parentChildType">Determine the relationship is natural or adopted</param>
        public ChildRelationship(Person person, ParentChildModifier parentChildType)
        {
            this.RelationshipType = RelationshipType.Child;
            this.RelationTo = person;
            this.ParentChildModifier = parentChildType;
        }
    }

    /// <summary>
    /// Describes the kindship between a couple
    /// </summary>
    public class SpouseRelationship : Relationship
    {
        public SpouseModifier SpouseModifier;
        public DateTime? MarriageDate;
        public DateTime? DivorceDate;

        public SpouseRelationship() { }

        public SpouseRelationship(Person person, SpouseModifier spouseType)
        {
            this.RelationshipType = RelationshipType.Spouse;
            this.SpouseModifier = spouseType;
            this.RelationTo = person;
        }
    }

    /// <summary>
    /// Describes the kindship between a siblings
    /// </summary>
    public class SiblingRelationship : Relationship
    {
        public SiblingRelationship() { }

        public SiblingRelationship(Person person)
        {
            this.RelationshipType = RelationshipType.Sibling;
            this.RelationTo = person;
        }
    }

    /// <summary>
    /// Collection of relationship for a person object
    /// </summary>
    public class RelationshipCollection : ObservableCollection<Relationship> { }

    /// <summary>
    /// Enumeration of connection types between person objects
    /// </summary>
    public enum RelationshipType
    {
        Child,
        Parent,
        Sibling,
        Spouse
    }

    public enum SpouseModifier
    {
        Current,
        Former
    }

    public enum ParentChildModifier
    {
        Natural,
        Adopted
    }
}
